package com.aasa.siccosap.action;

import java.util.Enumeration;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class LogueoAction extends GenericaAction{

	
    public LogueoAction()
    {
    }

    public ActionForward logout(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
        throws Exception
    {
        HttpSession objL_Httpsession = request.getSession(false);
        Enumeration objL_enume = objL_Httpsession.getAttributeNames();
        while (objL_enume.hasMoreElements())
		 {
			objL_Httpsession.removeAttribute((String)objL_enume.nextElement());
					
		 }
        //for(Enumeration enume = objL_Httpsession.getAttributeNames(); enume.hasMoreElements(); objL_Httpsession.removeAttribute((String)enume.nextElement()));
        objL_Httpsession.invalidate();
        return mapping.findForward("toFinSesion");
    }
    
    
    public ActionForward goHome(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)throws Exception{
    	return mapping.findForward("inicio");
    }
    
}
